<template >
  <div id="lecturer_detail">
    <c-title :hide="false"
             :text='`${diyName}详情`'></c-title>
    <div class="lecturer-content">
      <div class="gap-line"></div>
      <div class="top-detail">
        <div :class=" introduce == '' ? 'name-row name-row-height' : 'name-row'">
          <img :src="lecturer.t_image">
          <span class="name-rol">{{lecturer.nickname}}</span>
        </div>
        <div class="about-row" v-if="introduce !== '' && introduce">简介：{{ introduce }}</div>
      </div>

      <div class="bottom">
        <van-tabs v-model="activeName" @click="handleClick" background="#F5F5F5" line-width="20px">
          <van-tab name="first" :title="`活动项目 ${total}`"></van-tab>
          <van-tab name="second" :title="`课程商品 ${shopTotal}`"></van-tab>
        </van-tabs>
        <div>
          <div v-show="activeName=='first'">
            <van-pull-refresh v-model="isLoading" @refresh="loadTop" success-text="刷新成功"  v-if="datas.length>0">
              <ul>
                <li class="list"
                    v-for="(list,index) in datas"
                    :key="index">
                  <div class="list-image">
                    <img :src="list.thumb"
                         class="left"
                         @click="toEnroll(list)">
                    <span class="text default"
                          v-show="list.registration_time<=now&&now<list.registration_end_time">报名中</span>
                    <span class="text default-wait"
                          v-show="now<list.registration_time">待开始</span>
                    <span class="text default-end"
                          v-show="now>=list.registration_end_time">已结束</span>
                  </div>
                  <div class="list-info">
                    <!-- <p>{{list.title}}</p> -->
                    <p class="bottom-status"><span class="price"
                            v-if="list.cash>0.00"><b>{{$i18n.t('money')}}</b>{{list.cash}}</span><span class="cash"
                            v-if="list.cash<=0.00">免费</span></p>
                    <p class="clock"><span>{{timestampToTime(list.start_time)}}开始</span></p>
                    <span class="address">{{list.city_name.substr(0,2)}}{{list.address}}</span>
                  </div>
                </li>
              </ul>
            </van-pull-refresh>
            <div class="blank"
                 v-if="datas.length<=0">
              <img src="../../assets/images/blank.png">
              <span>还没有记录哦</span>
            </div>
          </div>
          <div v-show="activeName=='second'">
            <van-pull-refresh v-model="isLoading" @refresh="loadShop" success-text="刷新成功"  v-if="shop.length>0">
              <ul class="shop-list">
                <li class="shop-item"
                    @click="gotoDetail(item)"
                    v-for="(item,index) in shop"
                    :key="index">
                  <div>
                    <img :src="item.thumb">
                  </div>
                  <p class="text">{{item.title}}</p>
                  <div class="item-price">
                    <p><span class="once"><b>¥</b>{{item.price}}</span><del>¥{{item.market_price}}</del></p>
                  </div>
                </li>
              </ul>
            </van-pull-refresh>
            <div class="blank"
                 v-if="shop.length<=0">
              <img src="../../assets/images/blank.png">
              <span>还没有记录哦</span>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import lecturer_detailcontroller from './lecturer_detailcontroller';
export default lecturer_detailcontroller;
</script>

<style lang="scss" rel="stylesheet/scss" scoped>
::v-deep .van-tab--active {
  font-weight: bold;
  font-size: 15px;
}
#lecturer_detail {
  .lecturer-content {
    .gap-line {
      width: 100%;
      height: 4rem;
      background-color: white;
      border-radius: 0.5rem;
    }
    .top-detail {
      margin: 0 0.8rem;
      background: linear-gradient(180deg, #F9F9F9 0%, #FFFFFF 100%);
      border-radius: 0.75rem;
      position: relative;
      top: -2.2rem;
      .name-row-height {
        height: 3.55rem !important;
      }
      .name-row {
        background-image: url("https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/images/resume_bg.png");
        background-repeat: no-repeat; /* 禁止重复 */
        background-size: cover; /* 图片尺寸自适应 */
        background-position: center; /* 图片居中 */
        display: flex;
        justify-content: flex-start;
        align-items: center;
        // height: 3.55rem;
        height: 3.5rem;
        width: 100%;
        position: relative;
        img {
          width: 3.55rem;
          height: 3.55rem;
          border-radius: 50%;
          margin: 0;
          position: absolute;
          top: -1.2rem;
          left: 1.1rem;
        }
        .name-rol {
          font-size: 1rem;
          font-weight: bold;
          color: #00001C;
          position: absolute;
          top: 0.7rem;
          left: 5.2rem;
        }
      }
      .about-row {
        font-size: 0.8rem;
        font-weight: 400;
        color: #6E6E79;
        text-align: left;
        padding: 0 1.1rem 0.85rem 1.5rem;
        margin-top: -0.6rem;
      }
    }


    .bottom {
      position: relative;
      top: -2rem;

      .list:last-child {
        margin-top: 0;
      }

      .list {
        display: flex;
        padding: 0.7rem;
        margin: 0.8rem;
        background: white;
        border-radius: 0.5rem;

        .list-image {
          width: 8.9375rem;
          height: 5.5938rem;
          position: relative;

          .left {
            width: 100%;
            height: 100%;
            border-radius: 0.5rem;
          }

          .text {
            position: absolute;
            left: 0;
            top: 0;
            width: 3rem;
            height: 1.3rem;
            border-radius: 0.5rem 0 0.5rem 0;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 12px;
          }
        }

        .list-info {
          display: flex;
          flex-direction: column;
          margin-left: 0.7rem;
          align-items: baseline;
          flex: 1;
          justify-content: space-between;

          p {
            font-size: 14px;
            text-align: left;
            display: flex;
          }

          .clock {
            font-size: 0.8rem;
            font-weight: 400;
            color: #00001C;

            .time {
              margin-left: 5px;
            }
          }

          p:first-child {
            margin-top: 0;
            display: -webkit-box;
            overflow: hidden;
            white-space: normal;
            text-overflow: ellipsis;
            word-wrap: break-word;
            -webkit-line-clamp: 2;

            /* autoprefixer: off */
            -webkit-box-orient: vertical;
          }

          .address {
            font-size: 0.85rem;
            font-weight: 400;
            color: #6E6E79;
            text-align: left;
          }

          .bottom-status {
            display: flex;
            justify-content: space-between;
            align-items: center;
            width: 100%;
            font-size: 0.95rem;
            font-weight: bold;
            color: #F15353;
            margin-top: 0.2rem;

          }
        }
      }

      .shop-list {
        background-color: #f5f5f5;
        display: flex;
        flex-wrap: wrap;
        padding-bottom: 1rem;
        padding-left: 0.8rem;
        padding-right: 0.8rem;
        justify-content: space-between;

        .shop-item {
          margin-top: 1rem;
          margin-right: 0.4rem;
          width: 10.6rem;
          display: flex;
          flex-direction: column;
          justify-content: space-between;
          background-color: #fff;
          border-radius: 0.5rem;

          .item-price {
            display: flex;
            justify-content: space-between;
            padding: 0 0.8rem 0.53rem 0.8rem;
            line-height: 1;

            .once {
              font-size: 0.95rem;
              font-weight: bold;
              color: #F15353;

            }

            del {
              color: #6E6E79;
              margin-left: 0.4rem;
              font-size: 0.85rem;
            }

            .sale {
              color: #8c8c8c;
            }
          }

          img {
            width: 100%;
            height: 5.5938rem;
            border-radius: 0.5rem 0.5rem 0 0;
          }

          .text {
            padding: 0.2rem 0.8rem 0.4rem 0.8rem;
            text-align: left;
            display: -webkit-box;
            overflow: hidden;
            white-space: normal;
            text-overflow: ellipsis;
            word-wrap: break-word;
            -webkit-line-clamp: 2;

            /* autoprefixer: off */
            -webkit-box-orient: vertical;
            font-size: 0.85rem;
            font-weight: bold;
            color: #00001C;
          }
        }

        .shop-item:nth-child(2n) {
          margin-right: 0;
        }
      }

      .blank {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding-top: 2rem;
        background-color: #f5f5f5;

        img {
          width: 6rem;
          height: 6rem;
        }

        span {
          margin-top: 15px;
          color: #ccc;
          font-size: 14px;
        }
      }
    }
  }

  .intro {
    text-align: left;
    font-size: 0.75rem;
    line-height: 1.25rem;
    color: #666;
    width: 90%;
    margin: 1rem auto 0.5rem;
    padding: 0.25rem 0.5rem;
    border-radius: 0.5rem;
    background: #f6f6f6;
  }

  .tapBottin {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
  }

  .hidenShow {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
  }

  .green {
    background-color: rgba(59, 179, 93, 0.2);
    color: #3bb35d;
  }

  .yellow {
    background-color: rgba(255, 177, 38, 0.2);
    color: #ffb126;
  }

  .red {
    background-color: rgba(255, 49, 38, 0.2);
    color: #ff3126;
  }

  .default {
    background-color: rgba(59, 179, 93, 0.8);
    color: #fff;
  }

  .default-end {
    background-color: rgb(0, 0, 0, 0.5);
    color: #fff;
  }

  .default-wait {
    background: rgba(249, 109, 32, 0.7);
    color: #fff;
  }
}
</style>
